<template>
	<view class="">
		<scroll-view  scroll-y="true" class="scroll-Y" @scrolltolower="loadMore" style="height: 98vh;">
			<view class="jui_pad_2432 jui_bg_fff jui_mar_2432" v-for="(item,index) in list" :key="index">
				<view class="jui_bor_bottom jui_pad_b20">
					{{item.meal_name}}
				</view>
				<view class="jui_pad_t20">
					{{item.task_num}} x{{item.buy_num}}
				</view>
				<view class="jui_pad_t20">
					下单时间：{{item.create_time}}
				</view>
				<view class="jui_pad_t20">
					过期时间：{{item.expired_time}}
				</view>
				
				<view class="jui_pad_t20 flex justify-end">
					USDT{{item.money}}
				</view>
			</view>
		<!-- <view class="jui_mar_2432" >
			<view class="jui_flex jui_flex_justify_between jui_flex_items_center jui_bor_bottom jui_pad_b20" v-for="(item,index) in list" :key="index">
				<view class="">
					<view class="jui_fs34">
						{{item.create_time}}	
					</view>
					<view class="jui_fc_666 jui_fs30 jui_mar_t20">
						过期时间:{{item.expired_time}}
					</view>
				</view>
				<view class="" style="text-align: right;">
					<view class="jui_fc_333 jui_fs34">
						{{item.task_num}}
					</view>
					<view class="jui_fc_666 jui_fs30 jui_mar_t20">
						{{item.money}} u
					</view>
				</view>
			</view>
		</view> -->
		<!-- <shopro-empty v-if="!list.length" :emptyData="emptyData"></shopro-empty> -->
		</scroll-view>
	</view>
</template>

<script>
	
	export default {
		
		data(){
			return{
				emptyData: {
					img: '/static/imgs/home/empty_goods.png',
					tip: '暂无订单~'
				},
				list:[],
				FromToken:'',
				list_rows:20,
				page:1,
				hasMore:false,
			}
		},
		onLoad() {
			// 
		},
		onShow() {
			this.list = [];
			this.getFromToken()
		},
		methods:{
			getFromToken() {
				this.$api.getFromToken({data:1}).then(res => {
					if (res.code == 1) {
						this.FromToken = res.FromToken;
						this.order()
					}
				});
			},
			loadMore() {
				console.log(13456)
				if (this.hasMore) {
					this.page++;
					this.order();
				}
			},
			order(){
				let data = {
					page:this.page,
					list_rows: this.list_rows
				}
				this.$api.getMyMeal(data).then(res => {
					if (this.page == 1) {
						this.list = res.data.data;
					} else {
						this.list = [...this.list, ...res.data.data]
					}
					if (res.data.data.length == 0) {
						this.hasMore = false
					} else {
						this.hasMore = true
					}
				});
			},
		}
	}
</script>

<style>
	
</style>
